package com.servlet;

import com.dao.UserInfDao;
import com.dao.rechangedao;
import com.dao.rechangedaoimpl;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.net.UnknownServiceException;

public class pay extends HttpServlet {
    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        super.doPost(req, resp);
    }

    @Override
    protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        String dqid= (String) req.getSession().getAttribute("dqid");
        int money=Integer.parseInt(req.getParameter("yuE"));
        String sql="update user set Money=Money+? where UserID=?";
        UserInfDao u=new UserInfDao();
        u.update(sql,money,dqid);
        req.getSession().setAttribute("czcg","yes");
        req.getRequestDispatcher("/yue.jsp").forward(req,resp);
    }
}
